// Composition API 风格 

//官方
import { createApp } from 'vue'
import App from './App.vue'   //初始化组件App.vue

import { createPinia } from 'pinia'  //pinia
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'  //pinia 持久化

import router from './router'//router 路由

import ElementPlus from 'element-plus'// Element Plus (Vue 3 版本的 ElementUI)
import 'element-plus/dist/index.css'

import { createMetaManager } from 'vue-meta-next' // 引入 Vue 3 版本的 vue-meta




//自定义工具和组件

import plugins from './plugins/index.js'//自定义 弹框
import { NumberMul, $ShowVipPrice } from './libs/math.js' //自定义方法
import preventReClicks from './libs/directive' // 全局限制重复点击
//可以废弃
// import { setStore, getStore, removeStore } from '@/libs/storage'//storage 





// 其他库和工具
import plTable from 'pl-table'
import 'pl-table/themes/index.css'




// 全局组件
import Login from '@/components/forms/Login_Dialog.vue'
import NewPriceSlot from './components/NewPriceSlot.vue'
import NewPriceEncryptSlot from './components/NewPriceEncryptSlot.vue'

const app = createApp(App)


const pinia = createPinia()
pinia.use(piniaPluginPersistedstate);

// 使用插件
app.use(pinia)
app.use(router)
app.use(ElementPlus, { size: 'small' })
app.use(plugins)
app.use(preventReClicks)
app.use(plTable)
app.use(createMetaManager())

// 全局属性
app.config.globalProperties.NumberMul = NumberMul
app.config.globalProperties.$ShowVipPrice = $ShowVipPrice

// 注册全局组件
app.component(Login.name, Login)
app.component(NewPriceSlot.name, NewPriceSlot)
app.component(NewPriceEncryptSlot.name, NewPriceEncryptSlot)

// 事件总线 (Vue 3 不再内置事件总线，推荐使用 mitt 或直接使用 provide/inject)
// import emitter from'@/libs/mitt'
// app.config.globalProperties.$bus = emitter


// 防止localStorage在开发者工具中被手动篡改
// window.addEventListener('storage', function (e) {
//   localStorage.setItem(e.key, e.oldValue)
// });

app.mount('#app')














// import './assets/main.css'

// import { createApp } from 'vue'
// import { createPinia } from 'pinia'

// import App from './App.vue'
// import router from './router'

// const app = createApp(App)

// app.use(createPinia())
// app.use(router)

// app.mount('#app')